import { RouteRecordRaw } from 'vue-router';

import Layout from '../layout/index.vue'
import Home from '../views/home/home.vue'

// 根目录
const root = [
  { 
    path: '/',
    name: 'Layout',
    meta:{
      title: '后台面板',
      icon: 'HomeFilled',
    },
    component: Layout,
    children:[
      { 
        path: '/', 
        name: 'Home',
        meta:{
          title: '首页',
          icon: 'House',
        },
        component: Home
      },
      { 
        path: '/about',
        name: 'About',
        meta:{
          title: '关于',
          icon: 'Warning',
        },
        component: ()=> import('../views/about/about.vue'),
      },
    ]
  }, 
]

const admin = [
  { 
    path: '/admin',
    name: 'Admin',
    meta:{
      title: '管理员管理',
      icon: 'UserFilled',
    },
    component: Layout,
    children:[
      { 
        path: '/adminList', 
        name: 'AdminList',
        meta:{
          title: '管理员列表',
          icon: 'User',
        },
        component: ()=> import('../views/admin/adminList.vue'),
      }
      
    ]
  }, 
]

const user = [
  { 
    path: '/user',
    name: 'User',
    meta:{
      title: '用户管理',
      icon: 'UserFilled',
    },
    component: Layout,
    children:[
      { 
        path: '/userManage', 
        name: 'UserManage',
        meta:{
          title: '用户信息管理',
          icon: 'User',
        },
        component: ()=> import('../views/user/userManage.vue')
      },
      { 
        path: '/userLevel',
        name: 'UserLevel',
        meta:{
          title: '会员等级管理',
          icon: 'Operation',
        },
        component: ()=> import('../views/user/userLevel.vue')
      },
      
    ]
  }, 
]

const login = [
  { 
    path: '/login',
    name: 'Login',
    meta:{
      title: '登录',
      icon: 'User',
    },
    component: ()=> import('../views/login/login.vue'),
  }, 
]


// 生产环境路由
const routesProd: Array<RouteRecordRaw> = [
  ...root,
  ...user,
  ...admin,
  ...login,
  
]

// 开发环境路由
const routesDev: Array<RouteRecordRaw> = [
  ...routesProd

]

export default routesDev
